/**
 * 核心技术支持
 * IT渠道网 小程序商城
 * 13873174181 微信同号
 */
import {Base} from '../../utils/base.js';

class Product extends Base {
    constructor(){
        super();
    }
    /**
     * 商品详情
     */
    getDetailInfo(id, callback) {
      var param = {
        url: '/min/goods/getOne',
        data: {id: id},
        type: 'post',
        sCallback: function(data) {
          callback && callback(data);
        }
      };
      this.request(param);
    }
    /**
     * 相关推荐
     */
    getHotData(page, callback) {
      var param = {
          url: '/min/hot?page='+page,
          sCallback: function(data) {
            callback && callback(data);
          }
      };
      this.request(param);
    }
    /**
     * view
     */
    addView(id) {
      var param = {
          url: 'min/view/add?goodsId='+id
      };
      this.request(param);
    }
    /**
     * collection
     */
    getCollect(id, callback) {
      var param = {
        url: '/min/collect/index?goodsId='+id,
        sCallback: function(data) {
          callback && callback(data);
        }
      };
      this.request(param);
    }
    /**
     * add
     */
    addUserCollection(id, callback) {
      var param = {
        url: '/min/collect/add?goodsId='+id,
        sCallback: function(data) {
          callback && callback(data);
        }
      };
      this.request(param);
    }
    /**
     * del
     */
    deleteCollection(id, callback) {
      var param = {
        url: '/min/collect/del?goodsId='+id,
        sCallback: function(data) {
          callback && callback(data);
        }
      };
      this.request(param);
    }
};

export {Product};